import React, { useState } from 'react';

export default function SyncedInputs() {
    const [text, setText] = useState('');

    function handleChange(e) {
        setText(e.target.value);
    }

    console.log('4444')
    return (
        <>
            <Input text={text} handleChange={handleChange}  label="第一个输入框" />
            <Input text={text} label="第二个输入框" />
        </>
    );
}

function Input({ label,text,handleChange }) {


    return (
        <label>
            {label}
            {' '}
            <input
                value={text}
                onChange={handleChange}
            />
        </label>
    );
}
